package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.anno.AutoFill;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {
    // 新增分类菜品
    @AutoFill(OperationType.INSERT)
    void insert(Category category);

    Page<Category> pageQuery(CategoryPageQueryDTO categoryPageQueryDTO);
    @AutoFill(OperationType.UPDATE)
    void update(Category category);

    @Select("select * from category where type=#{type} ")
    List<Category> list(Integer type);
    @Delete("delete from sky_take_out.category where id=#{id}")
    Category deleteById(Long id);
    @Select("select id from sky_take_out.setmeal where category_id=#{id}")
    List<Long> getSetmealIdsByCategoryId(Long id);
}
